﻿using System.ComponentModel.Composition.Hosting;
using System.Web.Hosting;

namespace Mefisto4.Core.MEF
{
    public static class CompositionContainerFactory
    {
        public static CompositionContainer CreateContainer()
        {
            var catalog = new CatalogBuilder().ForMvcAssembliesInDirectory(HostingEnvironment.MapPath("~/bin"))
                                              .ForMvcAssembliesInDirectory(HostingEnvironment.MapPath("~/Modules"))
                                               .Build();

            var container = new CompositionContainer(catalog);

            return container;
        }
    }
}